<?php
$this->breadcrumbs=array(
	'Sales',
);

$this->menu=array(
	array('label'=>'Create Sales', 'url'=>array('create')),
	array('label'=>'Manage Sales', 'url'=>array('admin')),
);
?>

<h1>Sales</h1>


<div class="wide form">
<form id="yw0" action="/handson/index.php?r=sales" method="post">

<div class="row">
		<label for="Inventory_sku">SKU:</label>		<input size="55" maxlength="55" name="Inventory[sku]" 
		id="Inventory_sku" type="text" />	</div>
		
<div class="row">
		<label for="Inventory_qty">QTY:</label>		<input name="Inventory[qty]" 
		id="Inventory_qty" type="text" />	</div>
		
<div class="row buttons">
		<input type="submit" name="yt0" value="Search" />	

<?php
try{ 	
	if (is_array($inventoryModel)){
		foreach ($inventoryModel as $key => $value) {
		    print '<input type="hidden" name="orderItem['.$key.'][sku]" value="'.$value['sku'].'">';
		    print '<input type="hidden" name="orderItem['.$key.'][name]" value="'.$value['name'].'">';
		    print '<input type="hidden" name="orderItem['.$key.'][OrderQty]" value="'.$value['OrderQty'].'">';
		    print '<input type="hidden" name="orderItem['.$key.'][abh_price]" value="'.$value['abh_price'].'">';
		    print '<input type="hidden" name="orderItem['.$key.'][totalprice]" value="'.$value['totalprice'].'">';
		}
	}
}catch(Exception $ex){
	   		// do something	   		
	   	}
?>
		<input type="hidden" name="Language" value="English">		
</div>

</form>
</div><!-- search-form -->

<div>
	<table>
		<tr>
			<td colspan="5"><strong>Current Sales</strong></td>
		</tr>
		<tr>
			<td>SKU</td>
			<td>Name</td>
			<td>Qty</td>
			<td>Unit Price</td>
			<td>Total Price</td>
		</tr>
	   <?php 
try{	   
	if (is_array($inventoryModel)){
	   foreach ($inventoryModel as $key => $value) {
	   		print '<tr>';
	    	print '<td>'.$value['sku'].'</td>';
	    	print '<td>'.$value['name'].'</td>';
	    	print '<td>'.$value['OrderQty'].'</td>';
	    	print '<td>'.$value['abh_price'].'</td>';
	    	print '<td>'.$value['totalprice'].'</td>';
	    	print '</tr>';
	   }
	}
}catch(Exception $ex){
	   		// do something	   		
	   	}   
	    	
	   ?>
	  <tr>
			<td colspan="4" align="right"><strong>Subtotal : </strong></td>
			<td><strong>$0.00</strong></td>
		</tr>
		<tr>
			<td colspan="4" align="right"><strong>Taxes : </strong></td>
			<td><strong>$0.00</strong></td>
		</tr>
		<tr>
			<td colspan="4" align="right"><strong>Grand Total : </strong></td>
			<td><strong>$0.00</strong></td>
		</tr>
	</table>
</div>
<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); ?>
